attach(ToothGrowth)

table(supp, dose)

aggregate(len, by=list(supp, dose), FUN=mean)
aggregate(len, by=list(supp, dose), FUN=sd)

fit <- aov(len ~ supp*dose)
summary(fit)

interaction.plot(dose, supp, len, type="b",
                 col=c("red", "blue"), pch=c(16, 18),
                 main="Interaction between DOSE and SUPPLEMENT")

library(gplots)
plotmeans(len~interaction(supp, dose, sep=" "),
          connect=list(c(1,3,5), c(2,4,6)),
          col=c("red", "darkgreen"),
          main="Interaction plot with 95% CI",
          xlab="Treatment and dose combination")

library(HH)
interaction2wt(len~supp*dose)
